#!/bin/env python
# -*- coding: utf-8 -*-
'''
__title__ = ''
__author__ = 'dingc'
__mtime__ = '2020/11/5'
# code is far away from bugs with the god
'''
import psutil
from psutil._pslinux import svmem
from psutil._common import sswap

def main():
    vm:svmem = psutil.virtual_memory()
    sm:sswap = psutil.swap_memory()
    tmps = "%-7s %10s %10s %10s %10s %10s %10s"
    print(tmps % ('','total','used','free','shared','buffers','cached'))

    print(tmps % (
        'mem',
        vm.total,
        vm.used,
        vm.free,
        vm.shared,
        vm.buffers,
        vm.cached
    ))
    print(tmps % (
        'swap',
        sm.total,
        sm.used,
        sm.free,
        '',
        '',
        ''
    ))



if __name__ == "__main__":
    main()